using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class EnemyUI : MonoBehaviour
{
    [SerializeField] CharacterStats stats;

    [SerializeField] private Slider hpSlider;

    private void Start()
    {
        stats.onHealthChanged += UpdataHPUI;
    }

    #region Update UI Function

    private void UpdataHPUI()
    {
        hpSlider.maxValue = stats.GetFinalMaxHP();
        hpSlider.value = stats.currentHP;
    }


    #endregion

    private void OnDisable()
    {
        stats.onHealthChanged -= UpdataHPUI;
    }
}
